{% extends 'item-bank-exercise-manage/chapter-exercise/layout.html.twig' %}
{% do script(['libs/jquery-sortable.js','app/js/course-manage/lesson-manage/item/index.js']) %}
{% set course_side_nav = 'chapter' %}
{% block main_body %}
  {% include 'item-bank-exercise-manage/chapter-exercise/header.html.twig' with {taskMode:'lesson'}  %}
  <div style="margin: 20px auto;display: {% if categoryTree %}block{% else %}none{% endif %}">
    <span class="chapter-exercise-title" style="margin-left:27px">{{ 'item_bank_exercise.chapter_exercise.list'|trans }}</span>
    <span class="chapter-exercise-title" style="float: right">{{ 'item_bank_exercise.chapter_exercise.item_num'|trans }}</span>
  </div>
  <ul id="sortable-list" class="task-manage-list sortable-list">
    {% for key, item in categoryTree %}
      {% if item.depth == 3 %}
        {% include 'item-bank-exercise-manage/chapter-exercise/lesson.html.twig' with {exercise: exercise, lesson: item} %}
      {% else %}
        {% include 'item-bank-exercise-manage/chapter-exercise/item.html.twig' with {chapter:item, exercise:exercise} %}
      {% endif %}
    {% endfor %}
  </ul>
  <div class="empty task-empty js-task-empty {% if categoryTree %} hidden {% endif %}">
    <i class="es-icon es-icon-book task-empty-icon"></i>
    {% if exercise.chapterEnable %}
      {{'item_bank_exercise.chapter_exercise.category_empty'|trans}}
    {% else %}
      {{'item_bank_exercise.chapter_exercise.empty'|trans}}
    {% endif %}
  </div>
{% endblock %}
